package kr.ac.ml.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ac.kr.ml.dao.ContentListDao;
import ac.kr.ml.vo.WriteVo;
import kr.ac.ml.mvc.Action;
import kr.ac.ml.mvc.HttpUtil;

public class MeAction extends Action {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		// TODO Auto-generated method stub
		
		System.out.println("MeAction");
		String keyStr = request.getParameter("key");
		int key = Integer.parseInt(keyStr);
		System.out.println("key  : " + key);
		
		ContentListDao dao =  new ContentListDao();
		List<WriteVo> list = dao.getListByKey(key);
		
		request.setAttribute("list", list);		
		request.setAttribute("state", "me");
		HttpUtil.forward(request, response, "/views/me.jsp");

	}

}
